//package com.ailink.foodshop.redis;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.data.redis.support.collections.RedisCollectionFactoryBean;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
//@Component
//public class PlanMac {
//
//    private final String HEAD_OF_PLAN_CODE = "mac_";
//
//    @Autowired
//    private StringRedisTemplate redisTemplate;
//
//    public void test() {
//        redisTemplate.opsForValue().set("test", "value");
//        String ret = redisTemplate.opsForValue().get("test");
//        RedisConnectionFactory redisConnectionFactory = redisTemplate.getConnectionFactory();
//    }
//
//    public boolean save(String planCode, List<String> macList) {
//        String key = HEAD_OF_PLAN_CODE + planCode;
//        Long ret = redisTemplate.opsForList().leftPushAll(key, macList);
//        if (ret == macList.size()) {
//            return true;
//        } else {
//            return false;
//        }
//    }
//
//    public String get(String planCode) {
//        String key = HEAD_OF_PLAN_CODE + planCode;
//        return redisTemplate.opsForList().rightPop(key);
//    }
//
//}
